import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
import persistedState from 'vuex-persistedstate'
export default new Vuex.Store({
  state: {
    message:[
      {
        name:"小贱贱",
        tel:"123",
        di:"北京",
        zhi:"村子"
      },

    ]
  },
  getters: {
  },
  mutations: {
    //添加留言
    addobj(state,obj){
      state.message.push(obj)
    },
    //删除
    delobj(state,index){
      state.message.splice(index,1)
    },
    //设置默认
    setAddress(state,index){
      state.arr.forEach(item=>{
        item.isdefault=false
      })
      state.arr[index].isdefault=true
    },

  },
  actions: {
  },
  modules: {
  },
  plugins: [persistedState()]
})
